<form id="form" class="layui-form" action="{:url()}" method="post">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">上级权限</label>
            <div class="layui-input-inline">
                <select name="pid">
                    <option value="0">顶级目录</option>
                    {volist name="firstMenuList" id="vo"}
                        <option value="{$vo['id']}">{$vo['name']}</option>
                    {/volist}
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">权限名称</label>
        <div class="layui-input-inline">
            <input type="text" name="name" class="layui-input" placeholder="必填">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">路由</label>
        <div class="layui-input-inline">
            <input type="text" name="path" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">图标</label>
        <div class="layui-input-inline">
            <input type="text" name="icon" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">如果是顶级菜单才需要（layui内的icon）</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">排序</label>
        <div class="layui-input-inline">
            <input type="text" name="sort" value="50" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="启用" checked>
            <input type="radio" name="status" value="0" title="禁用">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">菜单展示</label>
        <div class="layui-input-block">
            <input type="radio" name="is_show" value="1" title="展示" checked>
            <input type="radio" name="is_show" value="0" title="隐藏">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="button" class="layui-btn submitForm" formId="form">提交</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    $(function(){
        var currentLayerIndex = parent.layui.layer.getFrameIndex(window.name);

        $('.submitForm').click(function (evt) {
            formPost(evt, $(this), function (res) {
                ybLayer.msg(res.msg,{icon: 6});
                setTimeout(function () {
                    parent.layui.layer.close(currentLayerIndex);
                    parent.location.reload();
                }, 1000);
            }, function (res) {
                ybLayer.msg(res.msg, {icon: 5});
            });
            return false;
        });
    })
</script>